
import { axiosInstance } from "..";

function getM10L10Approve(){
    const username = localStorage.getItem('username')?.toString()
    return new Promise((resolve,reject)=>{
        axiosInstance()
        .post("/material/approve/getML10docid",{username})
        .then(
            (res:any)=>{
                resolve(res)
            },
            (err:any)=>{
                reject(err)
            }
        )
    })
}

function getM10L10ApproveDetail(docid:string){
   return new Promise((resolve,reject)=>{
    axiosInstance()
    .post("/material/approve/getML10detail",{docid})
    .then(
        (res:any)=>{
            resolve(res)
        },
        (err:any)=>{
            reject(err)
        }
    )
   })
}

function M10Approve(docinfo:string,docdetail:string){
    return new Promise((resolve,reject)=>{
        axiosInstance()
        .post("/material/approve/Approve",{docinfo,docdetail})
        .then(
            (res:any)=>{
                resolve(res)
            },
            (err:any)=>{
                reject(err)
            }
        )
    })
}

function flowReject(info:string){
    return new Promise((resolve,reject)=>{
        axiosInstance()
        .post("/material/approve/Reject",{info})
        .then(
            (res:any)=>{
                resolve(res)
            },
            (err:any)=>{
                reject(err)
            }
        )
    })
}

export {
    getM10L10Approve,
    getM10L10ApproveDetail,
    M10Approve,
    flowReject
}